<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>使用map集合遍历数据</title>
</head>
<body>
    <h2 align="center">通过map集合遍历数据</h2>
    <hr>
    <h3>先看看从map中获取的entries</h3>
    <table style="margin: auto" border="1px">
        <tr>
            <th>entries</th>
        </tr>
        <tr  th:each="entries:${stuMap}">
            <th th:text="${entries}"></th>
        </tr>
    </table>
    <hr>
    <h3>开始遍历</h3>
    <table style="text-align: center;margin: auto" border="1px">
        <tr>
            <th>序号</th>
            <th>id</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>生日</th>
        </tr>
        <tr th:each="entries,serial:${stuMap}">
<!--            序号-->
            <td th:text="${serial.count}"></td>
<!--            id-->
            <td th:text="${entries.value.stuId}"></td>
<!--            姓名-->
            <td th:text="${entries.value.stuName}"></td>
<!--            年龄-->
            <td th:text="${entries.value.stuAge}"></td>
<!--            生日-->
            <td th:text="${entries.value.stuBirthday eq null?'保密':
                            #dates.format(entries.value.stuBirthday,'yyyy-MM-dd')}"></td>
        </tr>
    </table>
</body>
</html>